<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base = "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
    <input type="hidden" id="id" name="id" value="${engine.id!}">
    <div class="layui-form-item">
        <label class="layui-form-label">设备名称</label>
        <div class="layui-input-block">
            <input type="text" id="name" name="name" value="${engine.name!}" autocomplete="off" placeholder="请输入设备名称"
                   class="layui-input">

            <button type="button" class="layui-btn" id="name-url">
                <i class="layui-icon">&#xe67c;</i>设备名称图片上传
            </button>

            <button type="button" class="layui-btn" onclick="cancelNameUrl()">
                取消图片上传
            </button>
            <img id="name-url-img" src="${engine.nameUrl!}">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">设备用途</label>
        <div class="layui-input-block">
            <input type="text" id="purpose" name="purpose" value="${engine.purpose!}" autocomplete="off"
                   placeholder="请输入设备用途"
                   class="layui-input">
            <button type="button" class="layui-btn" id="purpose-url">
                <i class="layui-icon">&#xe62c;</i>设备用途 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelPurposeUrl()">
                取消图片上传
            </button>
            <img id="purpose-url-img" src="${engine.purposeUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">设备检定情况及相关要求</label>
        <div class="layui-input-block">
            <input type="text" id="requirement" name="requirement" value="${engine.requirement!}" autocomplete="off"
                   placeholder="请输入设备检定情况及相关要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="requirement-url">
                <i class="layui-icon">&#xe62c;</i>设备检定情况及相关要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelRequirementUrl()">
                取消图片上传
            </button>
            <img id="requirement-url-img" src="${engine.requirementUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">功能要求（协议书）</label>
        <div class="layui-input-block">
            <input type="text" id="function" name="function" value="${engine.function!}" autocomplete="off"
                   placeholder="请输入功能要求（协议书）"
                   class="layui-input">
            <button type="button" class="layui-btn" id="function-url">
                <i class="layui-icon">&#xe62c;</i>功能要求（协议书） 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelFunctionUrl()">
                取消图片上传
            </button>
            <img id="function-url-img" src="${engine.functionUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性能指标要求（协议书）</label>
        <div class="layui-input-block">
            <input type="text" id="performance" name="performance" value="${engine.performance!}" autocomplete="off"
                   placeholder="请输入性能指标要求（协议书）"
                   class="layui-input">
            <button type="button" class="layui-btn" id="performance-url">
                <i class="layui-icon">&#xe62c;</i>性能指标要求（协议书） 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelPerformanceUrl()">
                取消图片上传
            </button>
            <img id="performance-url-img" src="${engine.performanceUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">接口要求</label>
        <div class="layui-input-block">
            <input type="text" id="Interface" name="Interface" value="${engine.interface!}" autocomplete="off"
                   placeholder="请输入接口要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="Interface-url">
                <i class="layui-icon">&#xe62c;</i>接口要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelInterfaceUrl()">
                取消图片上传
            </button>
            <img id="Interface-url-img" src="${engine.interfaceUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">重量要求</label>
        <div class="layui-input-block">
            <input type="text" id="weight" name="weight" value="${engine.weight!}" autocomplete="off"
                   placeholder="请输入重量要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="weight-url">
                <i class="layui-icon">&#xe62c;</i>重量要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelWeightUrl()">
                取消图片上传
            </button>
            <img id="weight-url-img" src="${engine.weightUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">尺寸要求</label>
        <div class="layui-input-block">
            <input type="text" id="size" name="size" value="${engine.size!}" autocomplete="off" placeholder="请输入尺寸要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="size-url">
                <i class="layui-icon">&#xe62c;</i>尺寸要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelSizeUrl()">
                取消图片上传
            </button>
            <img id="size-url-img" src="${engine.sizeUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电源特性要求</label>
        <div class="layui-input-block">
            <input type="text" id="powerSupply" name="powerSupply" value="${engine.powerSupply!}" autocomplete="off"
                   placeholder="请输入电源特性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="powerSupply-url">
                <i class="layui-icon">&#xe62c;</i>电源特性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelPowerSupplyUrl()">
                取消图片上传
            </button>
            <img id="powerSupply-url-img" src="${engine.powerSupplyUrl!}">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">寿命</label>
        <div class="layui-input-block">
            <input type="text" id="life" name="life" value="${engine.life!}" autocomplete="off" placeholder="请输入寿命"
                   class="layui-input">
            <button type="button" class="layui-btn" id="life-url">
                <i class="layui-icon">&#xe62c;</i>寿命 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelLifeUrl()">
                取消图片上传
            </button>
            <img id="life-url-img" src="${engine.lifeUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">可靠性要求</label>
        <div class="layui-input-block">
            <input type="text" id="reliability" name="reliability" value="${engine.reliability!}" autocomplete="off"
                   placeholder="请输入可靠性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="reliability-url">
                <i class="layui-icon">&#xe62c;</i>可靠性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelReliabilityUrl()">
                取消图片上传
            </button>
            <img id="reliability-url-img" src="${engine.reliabilityUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">维修性要求</label>
        <div class="layui-input-block">
            <input type="text" id="maintainability" name="maintainability" value="${engine.maintainability!}"
                   autocomplete="off" placeholder="请输入维修性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="maintainability-url">
                <i class="layui-icon">&#xe62c;</i>维修性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelMaintainabilityUrl()">
                取消图片上传
            </button>
            <img id="maintainability-url-img" src="${engine.maintainabilityUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">测试性要求</label>
        <div class="layui-input-block">
            <input type="text" id="testability" name="testability" value="${engine.testability!}" autocomplete="off"
                   placeholder="请输入测试性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="testability-url">
                <i class="layui-icon">&#xe62c;</i>测试性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelTestabilityUrl()">
                取消图片上传
            </button>
            <img id="testability-url-img" src="${engine.testabilityUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">安全性要求</label>
        <div class="layui-input-block">
            <input type="text" id="security" name="security" value="${engine.security!}" autocomplete="off"
                   placeholder="请输入安全性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="security-url">
                <i class="layui-icon">&#xe62c;</i>安全性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelSecurityUrl()">
                取消图片上传
            </button>
            <img id="security-url-img" src="${engine.securityUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">保障性要求</label>
        <div class="layui-input-block">
            <input type="text" id="supportability" name="supportability" value="${engine.supportability!}"
                   autocomplete="off" placeholder="请输入保障性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="supportability-url">
                <i class="layui-icon">&#xe62c;</i>保障性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelSupportabilityUrl()">
                取消图片上传
            </button>
            <img id="supportability-url-img" src="${engine.supportabilityUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">环境适应性要求</label>
        <div class="layui-input-block">
            <input type="text" id="environment" name="environment" value="${engine.environment!}" autocomplete="off"
                   placeholder="请输入环境适应性要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="environment-url">
                <i class="layui-icon">&#xe62c;</i>环境适应性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelEnvironmentUrl()">
                取消图片上传
            </button>
            <img id="environment-url-img" src="${engine.environmentUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电磁兼容性要求</label>
        <div class="layui-input-block">
            <input type="text" id="electromagnetism" name="electromagnetism" value="${engine.electromagnetism!}"
                   autocomplete="off" placeholder="请输入电磁兼容性要求"
                   class="layui-input">

            <button type="button" class="layui-btn" id="electromagnetism-url">
                <i class="layui-icon">&#xe62c;</i>电磁兼容性要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelElectromagnetismUrl()">
                取消图片上传
            </button>
            <img id="electromagnetism-url-img" src="${engine.electromagnetismUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">计量保障要求</label>
        <div class="layui-input-block">
            <input type="text" id="metering" name="metering" value="${engine.metering!}" autocomplete="off"
                   placeholder="请输入计量保障要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="metering-url">
                <i class="layui-icon">&#xe62c;</i>计量保障要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelMeteringUrl()">
                取消图片上传
            </button>
            <img id="metering-url-img" src="${engine.meteringUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">包装运输要求</label>
        <div class="layui-input-block">
            <input type="text" id="packingTransport" name="packingTransport" value="${engine.packingTransport!}"
                   autocomplete="off" placeholder="请输入包装运输要求"
                   class="layui-input">
            <button type="button" class="layui-btn" id="packingTransport-url">
                <i class="layui-icon">&#xe62c;</i>包装运输要求 图片上传
            </button>
            <button type="button" class="layui-btn" onclick="cancelPackingTransportUrl()">
                取消图片上传
            </button>
            <img id="packingTransport-url-img" src="${engine.packingTransportUrl!}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">技术资料</label>
        <div class="layui-input-block">
            <input type="text" id="technology" name="technology" value="${engine.technology!}" autocomplete="off"
                   placeholder="请输入技术资料"
                   class="layui-input">

        </div>
    </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>

    <#--var name_url = "${engine.nameUrl!}",-->
    <#--    purpose_url = "${engine.purposeUrl!}",-->
    <#--    requirement_url = "${engine.requirementUrl!}",-->
    <#--    function_url = "${engine.functionUrl!}",-->
    <#--    performance_url = "${engine.performanceUrl!}",-->
    <#--    Interface_url = "${engine.interfaceUrl!}",-->
    <#--    weight_url = "${engine.weightUrl!}",-->
    <#--    size_url = "${engine.sizeUrl!}",-->
    <#--    powerSupply_url = "${engine.powerSupplyUrl!}",-->
    <#--    life_url = "${engine.lifeUrl!}",-->
    <#--    reliability_url = "${engine.reliabilityUrl!}",-->
    <#--    maintainability_url = "${engine.maintainabilityUrl!}",-->
    <#--    testability_url = "${engine.testabilityUrl!}",-->
    <#--    security_url = "${engine.securityUrl!}",-->
    <#--    supportability_url = "${engine.supportabilityUrl!}",-->
    <#--    environment_url = "${engine.environmentUrl!}",-->
    <#--    electromagnetism_url = "${engine.electromagnetismUrl!}",-->
    <#--    metering_url = "${engine.meteringUrl!}",-->
    <#--    packingTransport_url = "${engine.packingTransportUrl!}";-->


    var name_url = "${engine.nameUrl!}",
        purpose_url = "${engine.purposeUrl!}",
        requirement_url = "${engine.requirementUrl!}",
        function_url = "${engine.functionUrl!}",
        performance_url = "${engine.performanceUrl!}",
        Interface_url = "${engine.interfaceUrl!}",
        weight_url = "${engine.weightUrl!}",
        size_url = "${engine.sizeUrl!}",
        powerSupply_url = "${engine.powerSupplyUrl!}",
        life_url = "${engine.lifeUrl!}",
        reliability_url = "${engine.reliabilityUrl!}",
        maintainability_url = "${engine.maintainabilityUrl!}",
        testability_url = "${engine.testabilityUrl!}",
        security_url = "${engine.securityUrl!}",
        supportability_url = "${engine.supportabilityUrl!}",
        environment_url = "${engine.environmentUrl!}",
        electromagnetism_url = "${engine.electromagnetismUrl!}",
        metering_url = "${engine.meteringUrl!}",
        packingTransport_url = "${engine.packingTransportUrl!}";



    <#--var name_url = "${engine.nameUrl!}",-->
    <#--      purpose_url = $('#purpose-url-img').src==undefined?"":$('#purpose-url-img').src,-->
    <#--    requirement_url = $('#requirement-url-img').src==undefined?"":$('#requirement-url-img').src,-->
    <#--    function_url = $('#function-url-img').src==undefined?"":$('#function-url-img').src,-->
    <#--    performance_url = $('#performance-url-img').src==undefined?"":$('#performance-url-img').src,-->
    <#--    Interface_url = $('#Interface-url-img').src==undefined?"":$('#Interface-url-img').src,-->
    <#--    weight_url = $('#weight-url-img').src==undefined?"":$('#weight-url-img').src,-->
    <#--    size_url = $('#size-url-img').src==undefined?"": $('#size-url-img').src,-->
    <#--    powerSupply_url = $('#powerSupply-url-img').src==undefined?"":$('#powerSupply-url-img').src,-->
    <#--    life_url = $('#life-url-img').src==undefined?"":$('#life-url-img').src,-->
    <#--    reliability_url = $('#reliability-url-img').src==undefined?"":$('#reliability-url-img').src,-->
    <#--    maintainability_url = $('#maintainability-url-img').src==undefined?"":$('#maintainability-url-img').src,-->
    <#--    testability_url = $('#testability-url-img').src==undefined?"":$('#testability-url-img').src,-->
    <#--    security_url = $('#security-url-img').src==undefined?"":$('#security-url-img').src,-->
    <#--    supportability_url = $('#supportability-url-img').src==undefined?"":$('#supportability-url-img').src,-->
    <#--    environment_url = $('#environment-url-img').src==undefined?"":$('#environment-url-img').src,-->
    <#--    electromagnetism_url = $('#electromagnetism-url-img').src==undefined?"":$('#electromagnetism-url-img').src,-->
    <#--    metering_url = $('#metering-url-img').src==undefined?"":$('#metering-url-img').src,-->
    <#--    packingTransport_url = $('#packingTransport-url-img').src==undefined?"":$('#packingTransport-url-img').src;-->



    function cancelNameUrl() {
        //取消 图片的设置
        $("#name-url-img").attr('src', "");
        name_url = "";
    }

    function cancelPurposeUrl() {
        $("#purpose-url-img").attr('src', "");
        purpose_url = "";
    }

    function cancelRequirementUrl() {
        $("#requirement-url-img").removeAttr('src');
        requirement_url = ""
    }

    function cancelFunctionUrl() {
        $("#function-url-img").removeAttr('src');
        function_url = "";
    }

    function cancelPerformanceUrl() {
        $("#performance-url-img").removeAttr('src');
        performance_url = ""
    }

    function cancelInterfaceUrl() {
        $("#Interface-url-img").removeAttr('src');
        Interface_url = ""
    }

    function cancelWeightUrl() {
        $("#weight-url-img").removeAttr('src');
        weight_url = ""
    }

    function cancelSizeUrl() {
        $("#size-url-img").removeAttr('src');
        size_url = ""
    }

    function cancelPowerSupplyUrl() {
        $("#powerSupply-url-img").removeAttr('src');
        powerSupply_url = ""
    }

    function cancelLifeUrl() {
        $("#life-url-img").removeAttr('src');
        life_url = ""
    }

    function cancelReliabilityUrl() {
        $("#reliability-url-img").removeAttr('src');
        reliability_url = ""
    }

    function cancelMaintainabilityUrl() {
        $("#maintainability-url-img").removeAttr('src');
        maintainability_url = ""
    }

    function cancelTestabilityUrl() {
        $("#testability-url-img").removeAttr('src');
        testability_url = ""
    }

    function cancelSecurityUrl() {
        $("#security-url-img").removeAttr('src');
        security_url = ""
    }

    function cancelSupportabilityUrl() {
        $("#supportability-url-img").removeAttr('src');
        supportability_url = ""
    }

    function cancelEnvironmentUrl() {
        $("#environment-url-img").removeAttr('src');
        environment_url = ""
    }

    function cancelElectromagnetismUrl() {
        $("#electromagnetism-url-img").removeAttr('src');
        electromagnetism_url = ""
    }

    function cancelMeteringUrl() {
        $("#metering-url-img").removeAttr('src');
        metering_url = ""
    }

    function cancelPackingTransportUrl() {
        $("#packingTransport-url-img").removeAttr('src');
        packingTransport_url = ""
    }


    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form
            , layer = layui.layer, upload = layui.upload;


        var uploadInst = upload.render({
            elem: '#name-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#name-url-img").attr('src', res.data);
                name_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });

        upload.render({
            elem: '#purpose-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#purpose-url-img").attr('src', res.data);
                purpose_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#requirement-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#requirement-url-img").attr('src', res.data);
                requirement_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#function-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#function-url-img").attr('src', res.data);
                function_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#performance-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#performance-url-img").attr('src', res.data);
                performance_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#Interface-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#Interface-url-img").attr('src', res.data);
                Interface_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#weight-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#weight-url-img").attr('src', res.data);
                weight_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#size-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#size-url-img").attr('src', res.data);
                size_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#powerSupply-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#powerSupply-url-img").attr('src', res.data);
                powerSupply_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#life-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#life-url-img").attr('src', res.data);
                life_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#reliability-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#reliability-url-img").attr('src', res.data);
                reliability_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#maintainability-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#maintainability-url-img").attr('src', res.data);
                maintainability_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#testability-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#testability-url-img").attr('src', res.data);
                testability_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#security-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#security-url-img").attr('src', res.data);
                security_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#supportability-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#supportability-url-img").attr('src', res.data);
                supportability_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#environment-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#environment-url-img").attr('src', res.data);
                environment_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#electromagnetism-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#electromagnetism-url-img").attr('src', res.data);
                electromagnetism_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#metering-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#metering-url-img").attr('src', res.data);
                metering_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });
        upload.render({
            elem: '#packingTransport-url' //绑定元素
            , url: base + '/aircraftanalysis/setImg/' //上传接口
            , done: function (res) {
                //上传完毕回调
                $("#packingTransport-url-img").attr('src', res.data);
                packingTransport_url = res.data;
            }
            , error: function () {
                //请求异常回调
                alert("上传失败" + res.message);
            }
        });


        $("#submit").on("click", function () {

            console.log($('#name-url-img').src)
            console.log(name_url)
            console.log("${engine.nameUrl!}")

            if (check() === false) {
                return;
            }

            var formDate = {
                id: $("#id").val(),
                name: $("#name").val() + "==" + name_url,
                purpose: $("#purpose").val() + "==" + purpose_url,
                requirement: $("#requirement").val() + "==" + requirement_url,
                function: $("#function").val() + "==" + function_url,
                performance: $("#performance").val() + "==" + performance_url,
                Interface: $("#Interface").val() + "==" + Interface_url,
                weight: $("#weight").val() + "==" + weight_url,
                size: $("#size").val() + "==" + size_url,
                powerSupply: $("#powerSupply").val() + "==" + powerSupply_url,
                life: $("#life").val() + "==" + life_url,
                reliability: $("#reliability").val() + "==" + requirement_url,
                maintainability: $("#maintainability").val() + "==" + maintainability_url,
                testability: $("#testability").val() + "==" + testability_url,
                security: $("#security").val() + "==" + security_url,
                supportability: $("#supportability").val() + "==" + supportability_url,
                environment: $("#environment").val() + "==" + environment_url,
                electromagnetism: $("#electromagnetism").val() + "==" + electromagnetism_url,
                metering: $("#metering").val() + "==" + metering_url,
                packingTransport: $("#packingTransport").val() + "==" + packingTransport_url,
                technology: $("#technology").val()
            }
            $.ajax({
                type: "POST",
                url: base + "/aircraftanalysis/engine/admin/editEngine",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                          window.location.href = base + "/aircraftanalysis/engine/admin/main.html"
                    } else {

                    }
                }
            });
        })


        function check() {
            if ($("#name").val().length < 1) {
                layer.msg("请输入设备名称");
                return false;
            }
            if ($("#purpose").val().length < 1) {
                layer.msg("请输入设备用途");
                return false;
            }
            if ($("#requirement").val().length < 1) {
                layer.msg("请输入设备检定情况及相关要求");
                return false;
            }
            if ($("#function").val().length < 1) {
                layer.msg("请输入功能要求（协议书）");
                return false;
            }
            if ($("#performance").val().length < 1) {
                layer.msg("请输入性能指标要求（协议书）");
                return false;
            }
            if ($("#Interface").val().length < 1) {
                layer.msg("请输入接口要求");
                return false;
            }
            if ($("#weight").val().length < 1) {
                layer.msg("请输入重量要求");
                return false;
            }
            if ($("#size").val().length < 1) {
                layer.msg("请输入尺寸要求");
                return false;
            }
            if ($("#powerSupply").val().length < 1) {
                layer.msg("请输入电源特性要求");
                return false;
            }
            if ($("#life").val().length < 1) {
                layer.msg("请输入寿命");
                return false;
            }
            if ($("#reliability").val().length < 1) {
                layer.msg("请输入可靠性要求");
                return false;
            }
            if ($("#maintainability").val().length < 1) {
                layer.msg("请输入维修性要求");
                return false;
            }
            if ($("#testability").val().length < 1) {
                layer.msg("请输入测试性要求");
                return false;
            }
            if ($("#security").val().length < 1) {
                layer.msg("请输入安全性要求");
                return false;
            }
            if ($("#supportability").val().length < 1) {
                layer.msg("请输入保障性要求");
                return false;
            }
            if ($("#environment").val().length < 1) {
                layer.msg("请输入环境适应性要求");
                return false;
            }
            if ($("#electromagnetism").val().length < 1) {
                layer.msg("请输入电磁兼容性要求");
                return false;
            }
            if ($("#metering").val().length < 1) {
                layer.msg("请输入计量保障要求");
                return false;
            }
            if ($("#packingTransport").val().length < 1) {
                layer.msg("请输入包装运输要求");
                return false;
            }
            if ($("#technology").val().length < 1) {
                layer.msg("请输入技术资料");
                return false;
            }
        }
    });

</script>
</body>
</html>